<template>
  <div class="p-2">
    <div class="pos-relative flex flex-col h-88vh">
      <el-table border v-loading="loading" :data="tableList" height="400px">
        <el-table-column type="selection" width="55"> </el-table-column>
        <el-table-column type="index" label="序号" width="50" />
        <el-table-column align="center" label="单据编号" width="240">
          <template #default="scope">
            {{ scope.row.codeNo }}
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="检验数量"
          prop="deliveryDate"
          width="100"
        >
          <template #default="scope">
            {{ blankAttributeDefault(scope.row.checkNums) }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="单据状态" width="100">
          <template #default="scope">
            <dict-tag :options="data_status" :value="scope.row.dataStatus" />
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="检验类型"
          prop="deliveryDate"
          width="100"
        >
          <template #default="scope">
            <dict-tag :options="check_type" :value="scope.row.checkType" />
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="产品编码"
          prop="deliveryDate"
          width="100"
        >
          <template #default="scope">
            {{ blankAttributeDefault(scope.row.matterFullCode) }}
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="产品名称"
          prop="deliveryDate"
          width="150"
        >
          <template #default="scope">
            {{ blankAttributeDefault(scope.row.matterName) }}
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="助记码"
          prop="deliveryDate"
          width="100"
        >
          <template #default="scope">
            {{ blankAttributeDefault(scope.row.matterMnemonicCode) }}
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="规格型号"
          prop="deliveryDate"
          width="150"
        >
          <template #default="scope">
            {{ blankAttributeDefault(scope.row.matterSpecModel) }}
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="表面"
          prop="deliveryDate"
          width="100"
        >
          <template #default="scope">
            {{ blankAttributeDefault(scope.row.surfaceName) }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="滑块数量" width="100">
          <template #default="scope">
            {{ blankAttributeDefault(scope.row.sliderNum) }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="单轨长度(mm)" width="100">
          <template #default="scope">
            {{ blankAttributeDefault(scope.row.monorailLength) }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="滑块总数量" width="150">
          <template #default="scope">
            {{ blankAttributeDefault(scope.row.sliderAllNum) }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="导轨销售总长度(mm)" width="150">
          <template #default="scope">
            {{ blankAttributeDefault(scope.row.monorailAllLength) }}
          </template>
        </el-table-column>

        <el-table-column
          align="center"
          label="计量单位"
          prop="deliveryDate"
          width="100"
        >
          <template #default="scope">
            {{ blankAttributeDefault(scope.row.unitName) }}
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="辅助数量"
          prop="deliveryDate"
          width="100"
        >
          <template #default="scope">
            {{ blankAttributeDefault(scope.row.assistNums) }}
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="辅助单位"
          prop="deliveryDate"
          width="100"
        >
          <template #default="scope">
            {{ blankAttributeDefault(scope.row.assistUnitName) }}
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="合格数量"
          prop="deliveryDate"
          width="100"
        >
          <template #default="scope">
            {{ blankAttributeDefault(scope.row.passNums) }}
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="不合格数量"
          prop="deliveryDate"
          width="100"
        >
          <template #default="scope">
            {{ blankAttributeDefault(scope.row.unPassNums) }}
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="生产车间"
          prop="deliveryDate"
          width="150"
        >
          <template #default="scope">
            {{ blankAttributeDefault(scope.row.workshopName) }}
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="检验人"
          prop="deliveryDate"
          width="100"
        >
          <template #default="scope">
            {{ blankAttributeDefault(scope.row.matterSpecModel) }}
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="备注"
          prop="deliveryDate"
          width="150"
        >
          <template #default="scope">
            {{ blankAttributeDefault(scope.row.remark) }}
          </template>
        </el-table-column>
      </el-table>

      <pagination
        class="pos-absolute pos-bottom-20px pos-right-20px"
        v-show="total > 0"
        :total="total"
        v-model:page="queryParams.page"
        v-model:limit="queryParams.size"
        @pagination="getList"
      />
    </div>
  </div>
</template>

<script setup>
import { pageCheckProcessApi } from "@/api/pagesList";
import { blankAttributeDefault } from "@/utils/index";

const { proxy } = getCurrentInstance();

const props = defineProps({
  codeNo: undefined,
});

const { check_type } = toRefs(proxy?.useDict("check_type"));

const tableList = ref([]);
const loading = ref(true);
const total = ref(0);
const { data_status } = toRefs(proxy?.useDict("data_status"));

const queryParams = ref({
  page: 1,
  size: 10,
  taskCodeNo: props.codeNo,
});
/** 获取分页列表 */
const getList = async () => {
  const res = await pageCheckProcessApi(queryParams.value);
  tableList.value = res.data.data;
  total.value = res.data.total;
  loading.value = false;
};
getList();
</script>

<style lang="scss" scoped></style>
